#!/usr/bin/env python
# encoding: utf-8

from source.HQ.Interface import RealtimeHQ
import time


def Timer(func):
    def _(*args, **kwargs):
        st = time.time()
        ret = func(*args, **kwargs)
        ed = time.time()
        print(f"{func.__name__} time consuming:", round(ed-st, 1))
        return ret
    return _


@Timer
def unit_realtime_flush():
    rl = RealtimeHQ()
    rl.flush()


@Timer
def unit_realtime_flushOnce():
    rl = RealtimeHQ()
    rl.flushOnce('603716')
    rl.flushOnce('603602')
    rl.flushOnce('300689')
    rl.flushOnce('600351')
    rl.flushOnce('000001')
    rl.flushOnce('600109')
    rl.flushOnce('002259')
    rl.flushOnce('002031')
    rl.flushOnce('002277')
    rl.flushOnce('000965')
    rl.flushOnce('000004')


if __name__ == "__main__":
    unit_realtime_flushOnce()
    # unit_realtime_flush()
